import { Status } from "./component/logic";
import { locale } from "@/util/locale";
/**
 * 顶部菜单的那些按钮
 */
export const buttonList: { title: string; buttons: TypeContextMenuItem[] }[] = [
  {
    title: "接受",
    buttons: [
      {
        icon: "statics/icons/projectMerge/acceptCur.svg",
        disabled: false,
        key: "accept",
        tips: locale.value === "en" ? "Accept the selected items" : "接受选中变更项"
      },
      {
        icon: "statics/icons/projectMerge/acceptProperties.svg",
        disabled: false,
        key: "acceptWithAttribute",
        tips: locale.value === "en" ? "Accept the selected items with their properties" : "接受选中变更及其所有属性"
      },
      {
        icon: "statics/icons/projectMerge/acceptRecursive.svg",
        disabled: false,
        key: "acceptCascade",
        tips:
          locale.value === "en"
            ? "Accept the selected items with their properties and all submodels"
            : "接受选中变更及其所有属性以及其下所拥有的所有子级模型元素"
      }
    ]
  },
  {
    title: "拒绝",
    buttons: [
      {
        icon: "statics/icons/projectMerge/rejectCur.svg",
        disabled: false,
        key: "reject",
        tips: locale.value === "en" ? "Reject the selected items" : "拒绝选中变更"
      },
      {
        icon: "statics/icons/projectMerge/rejectProperties.svg",
        disabled: false,
        key: "rejectWithAttribute",
        tips: locale.value === "en" ? "Reject the selected items with their properties" : "拒绝选中变更及其所有属性"
      },
      {
        icon: "statics/icons/projectMerge/rejectRecursive.svg",
        disabled: false,
        key: "rejectCascade",
        tips:
          locale.value === "en"
            ? "Reject the selected items with their properties and all submodels"
            : "拒绝选中变更及其所有属性以及其下所拥有的所有子级模型元素"
      }
    ]
  }
  // {
  //   title: '',
  //   buttons: [
  //     {
  //       icon: "statics/header/topiconundo.svg",
  //       disabled: true,
  //       fn: () => {},
  //       tips: "撤销"
  //     },
  //     {
  //       icon: "statics/header/topiconredo.svg",
  //       disabled: true,
  //       fn: () => {},
  //       tips: "重做"
  //     }
  //   ]
  // },
];
export type TypeContextMenuItem = {
  label?: string;
  key: string;
  value?: string;
  disabled: boolean;
  showLabel?: boolean;
  editType?: string;
  group?: number;
  icon: string;
  showDivided?: boolean;
  tips?: string;
};

export enum MenuKey {
  accept = "accept",
  reject = "reject",
  acceptWithAttribute = "acceptWithAttribute",
  rejectWithAttribute = "rejectWithAttribute",
  acceptCascade = "acceptCascade",
  rejectCascade = "rejectCascade"
}
export enum ChildAcceptStatus {
  OTHER = 0,
  ALLACCEPT = 1,
  ALLREJECT = 2,
  ACCEPTANDREJECT = 3
}
export const contextMenuItem: TypeContextMenuItem[] = [
  {
    label: "接受",
    key: "accept",
    value: "mergeStatusChange",
    showLabel: false,
    disabled: false,
    editType: "button",
    group: 1,
    icon: "statics/icons/projectMerge/acceptCur.svg"
  },
  {
    label: "拒绝",
    key: "reject",
    value: "mergeStatusChange",
    showLabel: false,
    disabled: false,
    editType: "button",
    group: 1,
    icon: "statics/icons/projectMerge/rejectCur.svg"
  },
  {
    label: "带属性接受",
    key: "acceptWithAttribute",
    value: "mergeStatusChange",
    showLabel: false,
    disabled: false,
    editType: "button",
    group: 2,
    icon: "statics/icons/projectMerge/acceptProperties.svg",
    showDivided: true
  },
  {
    label: "带属性拒绝",
    key: "rejectWithAttribute",
    value: "mergeStatusChange",
    showLabel: false,
    disabled: false,
    editType: "button",
    group: 2,
    icon: "statics/icons/projectMerge/rejectProperties.svg"
  },
  {
    label: "递归接受",
    key: "acceptCascade",
    value: "mergeStatusChange",
    showLabel: false,
    disabled: false,
    editType: "button",
    group: 3,
    icon: "statics/icons/projectMerge/acceptRecursive.svg",
    showDivided: true
  },
  {
    label: "递归拒绝",
    key: "rejectCascade",
    value: "mergeStatusChange",
    showLabel: false,
    disabled: false,
    editType: "button",
    group: 3,
    icon: "statics/icons/projectMerge/rejectRecursive.svg"
  }
];
export const contextPropertyMenuItem: TypeContextMenuItem[] = [
  {
    label: "接受",
    key: "acceptMerge",
    value: "accept",
    disabled: false,
    showLabel: false,
    editType: "button",
    group: 1,
    icon: "statics/icons/projectMerge/acceptCur.svg"
  },
  {
    label: "拒绝",
    key: "rejectMerge",
    value: "reject",
    disabled: false,
    showLabel: false,
    editType: "button",
    group: 1,
    icon: "statics/icons/projectMerge/rejectCur.svg"
  }
];
export const initialLayout = [
  { x: 0, y: 0, w: 6, h: 10, i: 0, isDraggable: false, show: true },
  { x: 0, y: 10, w: 6, h: 2, i: 1, isDraggable: true, show: true },
  { x: 6, y: 0, w: 6, h: 10, i: 2, isDraggable: true, show: true },
  { x: 6, y: 10, w: 6, h: 2, i: 3, isDraggable: true, show: true }
];
export type VersionDiffInfo = {
  targetVersionInfo: string;
  sourceVersionInfo: string;
};
export type VersionCheckColumn = {
  props: string;
  label: string;
  isHighlight?: boolean;
};
export type PropertyValue = {
  uid: string;
  accept?: boolean;
  from: string;
  state?: Status;
  value: string;
  icon?: string;
  modelName?: string;
  valueSpecificationInfo: any;
};

export type MergeProperty = {
  cnName: string;
  dataType: string;
  name: string;
  propertyId: string;
  displayLevel: number;
  resultPropertyValue: Array<PropertyValue>;
  sourcePropertyValue: Array<PropertyValue>;
  targetPropertyValue: Array<PropertyValue>;
};
